﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DIST.LR.ZHJG.Pgybc.WCF.Interface;
using DIST.LR.ZHJG.Pgybc.WCF.EntityClass;
using NHibernate.Cfg;
using NHibernate;
using NHibernate.Linq;
using System.ServiceModel;

namespace DIST.LR.ZHJG.Pgybc.WCF.Manager
{
    public class TKPITYPEManager : EntitiesManager<TKPITYPE>
    {
        /// <summary>
        /// 重写Add方法
        /// </summary>
        /// <param name="infos">添加的对象集合</param>
        /// <returns>返回集合ID</returns>
        //public override IList<Int64> Add(IList<TKPITYPE> infos)
        //{
        //    IList<Int64> rids = new List<Int64>();
        //    string str = string.Format("from TKPITYPE as a where a.ID={}", infos[0].ID);

        //    //先执行删除操作
        //    IList<TKPITYPE> deinfos = this.Select(str);
        //    IList<Int64> ids = new List<Int64>();
        //    foreach (TKPITYPE info in deinfos)
        //    {
        //        ids.Add(info.ID);
        //    }
        //    this.Delete(ids);

        //    ISession session = NHibernateHelper.Instance().GetSession();
        //    ITransaction transaction = session.BeginTransaction();
        //    try
        //    {
        //        foreach (TKPITYPE info in infos)
        //        {
        //            rids.Add(Convert.ToInt64(session.Save(info)));
        //        }
        //        transaction.Commit();
        //        return rids;
        //    }
        //    catch
        //    {
        //        transaction.Rollback();
        //        return rids;
        //    }
        //    finally
        //    {
        //        session.Close();
        //    }
        //}
    }
}